package own.jndi;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class JNDIUtils {
	private static InitialContext ic=null;
	
	static{
		try {
			System.setProperty("java.naming.factory.initial",   
	                  "com.sun.jndi.fscontext.RefFSContextFactory");  
			System.setProperty(Context.PROVIDER_URL,   
					"com.sun.jndi.fscontext.RefFSContextFactory");  
			ic=new InitialContext();
			ic.bind("AAA", "2222");
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		try {
			System.out.println(ic.lookup("AAA"));
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
